/**
 * 给定数组A，对每个Ai，输出大于Ai的元素之和
 * 将A排序，然后从大到小对当前值回答即可
 * 最后统一输出答案
 */
#include <bits/stdc++.h>
using namespace std;

#include <bits/extc++.h>

using llt = long long;
using vi = vector<int>;

struct  _t{
    llt v;
    int idx;
};

int N;
vector<_t> A;

void proc(){
    map<int, vi> mm;
    for(auto i : A) mm[i.v].push_back(i.idx);

    vector<llt> ans(N, 0);
    
    llt level = 0;
    for(auto it=mm.rbegin(),et=mm.rend();it!=et;++it){
        for(auto i : it->second){
            ans[i] = level;
        }
        level += it->second.size() * (it->first + 0LL);
    }

    for(auto i : ans) cout << i << " ";
    cout << endl;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> N;
    A.assign(N, {});
    int k = 0;
    for(auto & t : A) cin >> t.v, t.idx = k++;
    proc();
    return 0;
}